


            var markers=new Array();
            var marker_count=0; 
            var lat=33.8;
            var url;
            var icon;
            var lon=-77.9;       
            var zoom = 4;
            var map;
            var lat_s=new Array();var lon_s=new Array();
            var url_s=new Array();

            var nos_array=[-75.75,36.18,8651370,-76.67,34.72,8656483,-75.55,35.8,8652587,-80.47,32.34,8668498,-79.92,32.78,8665530,-79.71,32.86,8664941,-79.19,33.35,8662245,-78.92,33.66,8661070,-78.51,33.87,8659897,-78.02,33.91,8659084,-77.95,34.23,8658120,-77.8,34.21,8658163];
            var nos_url="http://tidesandcurrents.noaa.gov/station_info.shtml"; 

            var ndbc_array=[-75.75,36.18,"DUCN7",-75.29,35.15,"41025",-76.52,34.62,"CLKN7",-77.58,33.48,"41013",-79.1,32.5,"41004",-79.89,32.68,"FBIS1",-75.42,32.27,"41002"];
            var ndbc_url="http://www.ndbc.noaa.gov/station_page.php";

            var nws_array=[-76.57,36.02,"KEDE",-76.18,36.27,"KECG",-75.67,36.02,"KFFA",-75.7,35.92,"KMQI",-75.62,35.23,"KHSE",-77.05,35.57,"KOCW",-77.05,35.07,"KEWN",-76.87,34.88,"KNKT",-76.65,34.73,"KMRH",-77.02,34.67,"KNJM",-77.45,34.72,"KNCA",-77.62,34.82,"KOAJ",-77.9,34.27,"KILM",-78.08,33.93,"KSUT",-78.72,33.82,"KCRE",-78.92,33.67,"KMYR",-80.03,32.9,"KCHS",-77.17,36.28,"KASJ",-77.4,35.62,"KPGV"];
            var nws_url="http://weather.noaa.gov/weather/current/";

            var rcoos_array=[-75.700667,36.167842,"FRF-17mwaverider",-75.7432,36.18825,"FRF-8mAWAC",-75.7432,36.18825,"FRF-8mAWAC",-75.5958,35.9101,"FRF-JennettePier",-75.745,36.1836,"FRF-Met",-75.96006,36.01811,"FRF-AlbemarleSound",-75.742886,36.187239,"FRF-8marray",-80.40,32.27,"FRP2",-77.71,34.14,"ILM2",-77.36,33.99,"ILM3",-78.15,33.9,"OCP1",-77.28,34.48,"LEJ2",-76.95,34.21,"LEJ3",-79.71,32.86,"CAP1",-79.62,32.8,"CAP2",-79.32,32.5,"CAP3",-80.47,32.34,"FRP1",-80.4,32.27,"FRP2",-78.48,33.83,"SUN2",-78.15,33.31,"SUN3",-79.937,32.651,"FollyBeach",-78.91,33.65,"Springmaid",-75.60,35.91,"NCCOOS-Jennette Pier",-77.03,34.66,"NCCOOS-Bogue-Inlet-Pier",-76.42,34.34,"NCCOOS-Lookout-shoals-Buoy",-79.1888,33.3493,"nerr-niwol",-80.4537,32.5587,"nerr-acesp",-77.8509,34.1555,"nerr-nocrc"];
            var rcoos_url="queryStation.php";  

	    //a test comment	

            function init(){

                var option= {
                       restrictedExtent: new OpenLayers.Bounds(-82, 31, -74, 37),
 	                scales: [4000000, 1000000, 500000, 250000],
 	                projection:"EPSG:4326",
 	                tileSize: new OpenLayers.Size(500,500),
 	                units: "degrees",
                        //scales: [9000000, 1900000],
                        //maxResolution: 1790.2,
                        //minResolution: 0.175,
                       // resolutions:[1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101,0.0006866455],
                         
                        controls: [new OpenLayers.Control.MousePosition({numdigits:2}),
                                  new OpenLayers.Control.MouseDefaults(),
                                   new OpenLayers.Control.PanZoomBar(),
                                   new OpenLayers.Control.Permalink('permalink'),
                                  
                                   new OpenLayers.Control.LayerSwitcher()]
                          };

                map = new OpenLayers.Map( 'map' ,option);

                //var land_wms = new OpenLayers.Layer.WMS( "UNC Land WMS", "http://maury.marine.unc.edu/cgi-bin/mapserv?", {
 	        //map:'/opt/secoora_ogc/maps/secoora_base.map',
 	         //       srs:'epsg:4269',
 	          //      format:'image/png',
 	          //     layers:'world_filled,us_filled,us_outline,world_outline',
 	           //    map_scalebar_status:'OFF'},
 	            //    {gutter: 10, buffer: 2}
 	                //{singleTile: true, ratio: 2}
 	              //  );

                var wms = new OpenLayers.Layer.WMS( "Matacarta Lab",
                          "http://labs.metacarta.com/wms/vmap0",
                          {layers: 'basic'} );
                
                 //var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
               // "http://t1.hypercube.telascience.org/cgi-bin/landsat7", 
               // {layers: "landsat7"});                          

               
                //var goog = new OpenLayers.Layer.Google( "Google Physical",{type:G_PHYSICAL_MAP});
               //var googlestreet = new OpenLayers.Layer.Google("Google Street");

                var yahoo = new OpenLayers.Layer.Yahoo( "Yahoo", { 'numZoomLevels':9,'SphericalMercator':true});

                var SCNCCoastPNG = new OpenLayers.Layer.Image(
                                        'SC-NC Coast',
                                        './images/ModisOverlaySCNCCoast.png',
                                        new OpenLayers.Bounds(-82, 31, -74, 37),
                                        new OpenLayers.Size(500, 500),
                                        {
                                          numZoomLevels: 4
                                        });        
               
                map.addLayers([wms,yahoo,SCNCCoastPNG]);

                var NOS = new OpenLayers.Layer.Markers("NOS station",{visibility:true});
                var size = new OpenLayers.Size(12,12);
                var offset=new OpenLayers.Pixel(-(size.w/2),-(size.h));
                var icon=new OpenLayers.Icon("lib/img/mm_20_blue.png",size,offset);
                for(var j=0;j<nos_array.length;j++){
                    if(j%3==2){
                      
                      lon_s[marker_count]=nos_array[j-2];
                      lat_s[marker_count]=nos_array[j-1];
                      url_s[marker_count]=nos_array[j];
                      markers[marker_count]=new OpenLayers.Marker(new OpenLayers.LonLat(lon_s[marker_count],lat_s[marker_count]),icon.clone());
             
                      markers[marker_count].url= url_s[marker_count];

                      markers[marker_count].events.register('click',markers[marker_count],function(evt){
                
                       OpenLayers.Event.stop(evt);
                       OpenLayers.Util.getElement('tform').innerHTML="<form name=sendform method=get target=_parent action=" + nos_url + "><input type=hidden name=stn value=" + this.url + "></form>";
                       document.sendform.submit();
                       }
                      );
                      markers[marker_count].events.register('mouseover',markers[marker_count],function(evt){
                       setMouseover(evt,this.url);
                       }
                     );
                     markers[marker_count].events.register('mouseout',markers[marker_count],function(evt){
                       setMouseout(evt);
                       } 
                     )                

                       NOS.addMarker(markers[marker_count]);
 
                       marker_count=marker_count+1;
                      
                    }
                }
                map.addLayer(NOS);                  

               var RCOOS = new OpenLayers.Layer.Markers("RCOOS station",{visibility:true});
                
                var icon1=new OpenLayers.Icon("lib/img/mm_20_yellow.png",size,offset);
                for(j=0;j<rcoos_array.length;j++){
                    if(j%3==2){
                      
                      lon_s[marker_count]=rcoos_array[j-2];
                      lat_s[marker_count]=rcoos_array[j-1];
                      url_s[marker_count]=rcoos_array[j];
                      
                      markers[marker_count]=new OpenLayers.Marker(new OpenLayers.LonLat(lon_s[marker_count],lat_s[marker_count]),icon1.clone());
             
                      markers[marker_count].url= url_s[marker_count];
                      
                      markers[marker_count].events.register('click',markers[marker_count],function(evt){
                
                       OpenLayers.Event.stop(evt);
                       OpenLayers.Util.getElement('tform').innerHTML="<form name=sendform method=get target=_parent action=" + rcoos_url + "><input type=hidden name=stn value=" + this.url + "></form>";
                       
                       document.sendform.submit();
                       }
                      );
                      markers[marker_count].events.register('mouseover',markers[marker_count],function(evt){
                       setMouseover(evt,this.url);
                       }
                     );
                     markers[marker_count].events.register('mouseout',markers[marker_count],function(evt){
                       setMouseout(evt);
                       } 
                     )         

                       RCOOS.addMarker(markers[marker_count]);
                       marker_count=marker_count+1;
                      
                    }
                }
                map.addLayer(RCOOS);
           
               var NDBC = new OpenLayers.Layer.Markers("NDBC station",{visibility:true});
               
                
                for(j=0;j<ndbc_array.length;j++){
                    if(j%3==2){
                      
                      lon_s[marker_count]=ndbc_array[j-2];
                      lat_s[marker_count]=ndbc_array[j-1];
                      url_s[marker_count]=ndbc_array[j];
                      markers[marker_count]=new OpenLayers.Marker(new OpenLayers.LonLat(lon_s[marker_count],lat_s[marker_count]),icon.clone());
             
                      markers[marker_count].url= url_s[marker_count];

                      markers[marker_count].events.register('click',markers[marker_count],function(evt){
                
                       OpenLayers.Event.stop(evt);
                       OpenLayers.Util.getElement('tform').innerHTML="<form name=sendform method=get target=_parent action=" + ndbc_url + "><input type=hidden name=station value=" + this.url + "></form>";
                       
                       document.sendform.submit();
                       }
                      );
                      markers[marker_count].events.register('mouseover',markers[marker_count],function(evt){
                       setMouseover(evt,this.url);
                       }
                     );
                     markers[marker_count].events.register('mouseout',markers[marker_count],function(evt){
                       setMouseout(evt);                      
                       } 
                     )         

                       NDBC.addMarker(markers[marker_count]);
                       marker_count=marker_count+1;
                      
                    }
                }
                map.addLayer(NDBC);           

                var NWS = new OpenLayers.Layer.Markers("NWS station",{visibility:true});
                        

                for(j=0;j<nws_array.length;j++){
                    if(j%3==2){
                      
                      lon_s[marker_count]=nws_array[j-2];
                      lat_s[marker_count]=nws_array[j-1];
                      url_s[marker_count]=nws_array[j];
                      markers[marker_count]=new OpenLayers.Marker(new OpenLayers.LonLat(lon_s[marker_count],lat_s[marker_count]),icon.clone());
             
                      markers[marker_count].url= url_s[marker_count];
 
                      markers[marker_count].events.register('click',markers[marker_count],function(evt){
                
                       OpenLayers.Event.stop(evt);
                       OpenLayers.Util.getElement('tform').innerHTML="<form name=sendform method=get target=_parent action=" + nws_url + this.url + ".html></form>";
                       
                       document.sendform.submit();
                       }
                      );
                      markers[marker_count].events.register('mouseover',markers[marker_count],function(evt){
                       setMouseover(evt,this.url);
                       }
                     );
                     markers[marker_count].events.register('mouseout',markers[marker_count],function(evt){
                       setMouseout(evt);
                       } 
                     )         

                       NWS.addMarker(markers[marker_count]);
                       marker_count=marker_count+1;
                      
                    }
                }
                map.addLayer(NWS);           
                map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
           }

function setMouseover(evt,url){
                      OpenLayers.Event.stop(evt);
                      OpenLayers.Util.getElement('rolloverbox').innerHTML= "Station: " + url + "<br>" + data_array[url];
}
 
function setMouseout(evt){    
                       OpenLayers.Event.stop(evt);
                       OpenLayers.Util.getElement('rolloverbox').innerHTML="";
                       
                         
                          
}
